home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / dvibook / libtex / num.h < prev    next >
Text File  |  1994-03-18  |  1KB  |  40 lines

  1. /*
  2.  * Copyright (c) 1987, 1989 University of Maryland
  3.  * Department of Computer Science.  All rights reserved.
  4.  * Permission to copy for any purpose is hereby granted
  5.  * so long as this copyright notice remains intact.
  6.  */
  7.  
  8. /*
  9.  * Pointer I/O: numbers.
  10.  *
  11.  * We deal in fixed format numbers and pointers here.
  12.  * For file I/O, see fio.h.
  13.  */
  14.  
  15. /*
  16.  * Get one unsigned byte.  Note that this is a proper expression.
  17.  * The rest have more limited contexts, and are therefore OddLy
  18.  * CapItaliseD.
  19.  */
  20. #define    pgetbyte(p)    UnSign8(*(p)++)
  21.  
  22. /*
  23.  * Get a two-byte unsigned integer, a three-byte unsigned integer,
  24.  * or a four-byte signed integer.
  25.  */
  26. #define    pGetWord(p, r) ((r)  = UnSign8(*(p)++) << 8, \
  27.             (r) |= UnSign8(*(p)++))
  28. #define    pGet3Byte(p,r) ((r)  = UnSign8(*(p)++) << 16, \
  29.             (r) |= UnSign8(*(p)++) << 8, \
  30.             (r) |= UnSign8(*(p)++))
  31. #define    pGetLong(p, r) ((r)  = UnSign8(*(p)++) << 24, \
  32.             (r) |= UnSign8(*(p)++) << 16, \
  33.             (r) |= UnSign8(*(p)++) << 8, \
  34.             (r) |= UnSign8(*(p)++))
  35.  
  36. /*
  37.  * ADD pputbyte, pPutWord, pPut3Byte, pPutLong HERE IF THEY PROVE
  38.  * USEFUL.  (But then must consider changing PutWord &c in fio.h.)
  39.  */
  40.